package chpt07;

public class DivisionV2TryCatch {
	static int getQuotient(int dividend, int divisor) {
		int quotient = dividend / divisor;
		return quotient;
	}

	public static void main(String[] args) {
		int dividend = 10;
		int divisor = 0;
		try {
			int quotient = getQuotient(dividend, divisor);
			System.out.println("被除数" + dividend +
					"除以除数" + divisor +
					"的商为：" + quotient);
		}catch (ArithmeticException e){
			System.out.println("除数必须为0");
		}
		System.out.println("程序结束！");
	}
}

